﻿using System;
using Garfield.Core.Runtime.SPI;

namespace Garfield.Core.Runtime
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
    public sealed class ServiceAttribute : Attribute, IDependencyAttribute
    {
        public object ProvideValue(IPlatformProvider platformProvider, Type expectedType)
        {
            return platformProvider.GetService(expectedType);
        }
    }
}
